import { createStore, createLogger } from 'vuex';

// 组装对象
const files = require.context('.', true, /\.js$/);
const modules = {};
files.keys().forEach((key) => {
	if (key === './index.js') return;
	const childModule = files(key).default;
	var moduleKey = key.slice(key.lastIndexOf('/') + 1).replace('.js', '');
	modules[moduleKey] = childModule;
});

export default createStore({
	modules : {
		...modules
	},
	plugins : [createLogger()],
	strict : process.env.NODE_ENV !== 'production'
});
